package com.cheyun.netsalev3.view.drivelist

import android.util.Log
import androidx.fragment.app.Fragment
import com.cheyun.netsalev3.R
import com.cheyun.netsalev3.adapter.HomePageAdapter
import com.cheyun.netsalev3.bean.ClueDetails
import com.cheyun.netsalev3.databinding.DriveListActivityBinding
import com.cheyun.netsalev3.utils.BaseActivity
import com.jeremyliao.liveeventbus.LiveEventBus
import java.util.Observer

class DriveListActivity : BaseActivity<DriveListActivityBinding>() {

    override fun initContentView(): Int {
        return R.layout.drive_list_activity
    }

    var titles = arrayListOf("全部", "已预约", "试驾中","待评价")
    var states = arrayListOf("0", "1","3","4")
    private var listFragmet = ArrayList<Fragment>()


    override fun initData() {

    }

//    override fun initViewModel(): ViewModel? {
//        if (state.isNotEmpty()) {
//            hashMap["nkey"] = "index"
//            hashMap["ckey"] = state
//        }
//        val factory = InjectorUtils.getStockQueryListViewModelFactory(hashMap)
//        return ViewModelProviders.of(this, factory).get(StockQueryListViewModel::class.java)
//    }

    override fun initView() {
        for (i in titles.indices) {
            listFragmet.add(DriveListFragment.newInstance(states[i]))
        }
        val pagerAdapter = HomePageAdapter(supportFragmentManager, listFragmet)
        pagerAdapter.titles = titles
        binding.viewPager.offscreenPageLimit = 3
        binding.viewPager.adapter = pagerAdapter
        binding.tabLayout.setupWithViewPager(binding.viewPager)

    }

}
